﻿<UserControl x:Class="AnthStat.WPF.Presentation.Controls.ProjectTypeChooser"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:controls="clr-namespace:AnthStat.WPF.Presentation.Controls"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="700">
    <Border BorderBrush="{StaticResource AccentVeryLightBrush}" BorderThickness="1" Background="White" Padding="10">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <StackPanel Grid.Row="0" Margin="0, 0, 0, 20">
                <TextBlock FontWeight="SemiBold" FontSize="24" Text="NEW PROJECT"/>
                <!--<TextBlock FontWeight="Normal" FontSize="12" Foreground="{StaticResource AccentBrush}" Text="Individual Assessments"/>-->
            </StackPanel>

            <StackPanel Grid.Row="1" Visibility="{Binding IsShowingNewProjectSettings, Converter={StaticResource BooleanToCollapsedConverter}, FallbackValue=Visible}">
                <ListView HorizontalAlignment="Center" ItemsSource="{Binding ProjectTypesCollectionView}" Style="{StaticResource NewProjectListViewStyle}">
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel Width="{Binding (FrameworkElement.ActualWidth), 
                                       RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}"
                                       ItemWidth="{Binding (ListView.View).ItemWidth, 
                                       RelativeSource={RelativeSource AncestorType=ListView}}"
                                       MinWidth="{Binding ItemWidth, RelativeSource={RelativeSource Self}}"
                                       ItemHeight="{Binding (ListView.View).ItemHeight, 
                                       RelativeSource={RelativeSource AncestorType=ListView}}" />
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>
                </ListView>
            </StackPanel>

            <StackPanel Grid.Row="1" Visibility="{Binding IsShowingNewProjectSettings, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Visible}">
                
                    <TextBlock Text="Title:" />
                <TextBox Padding="4" MaxLength="64" Text="{Binding NewProjectStub.Name}" />
                    <StackPanel Height="5" />

                    <TextBlock Text="Description:" />
                <TextBox Padding="4" Text="{Binding NewProjectStub.Description}" />
                    <StackPanel Height="5" />

                    <TextBlock Text="Author:" />
                <TextBox Padding="4" Text="{Binding NewProjectStub.Author}" />
                    <StackPanel Height="5" />

                <TextBlock Text="Indicator Set:" />
                <ComboBox Padding="4" SelectedIndex="0" ItemsSource="{StaticResource StandardsArray}"
                          SelectedValue="{Binding NewProjectStub.IndicatorSet}"
                          SelectedValuePath="ValueString"
                          DisplayMemberPath="DisplayString" />
                
                <StackPanel Height="5" />

            </StackPanel>

            <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0, 20, 0, 0" Visibility="{Binding IsShowingNewProjectSettings, Converter={StaticResource BooleanToCollapsedConverter}, FallbackValue=Visible}">
                <Button Style="{StaticResource DarkButtonStyle}" Width="100" IsEnabled="True" Background="{StaticResource AccentLightBrush}" Content="Next"
                        Command="{Binding SelectedProjectTypeCommand}" />
                <StackPanel Width="10" />
                <Button Style="{StaticResource DarkButtonStyle}" Width="100" IsEnabled="True" Background="{StaticResource AccentLightBrush}" Content="Cancel"
                        Command="{Binding CancelNewProjectCommand}"/>
            </StackPanel>

            <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0, 20, 0, 0" Visibility="{Binding IsShowingNewProjectSettings, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}">
                <Button Style="{StaticResource DarkButtonStyle}" Width="100" IsEnabled="True" Background="{StaticResource AccentLightBrush}" Content="Done"
                        Command="{Binding CreateNewProjectCommand}" />
                <StackPanel Width="10" />
                <Button Style="{StaticResource DarkButtonStyle}" Width="100" IsEnabled="True" Background="{StaticResource AccentLightBrush}" Content="Back"
                        Command="{Binding ReturnToProjectTypeSelectorCommand}" />
                <StackPanel Width="10" />
                <Button Style="{StaticResource DarkButtonStyle}" Width="100" IsEnabled="True" Background="{StaticResource AccentLightBrush}" Content="Cancel"
                        Command="{Binding CancelNewProjectCommand}"/>
            </StackPanel>
        </Grid>
    </Border>
</UserControl>
